﻿﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using WeiXinSDK.DataModel.Enum;

namespace WeiXinSDK.DataModel
{
    [XmlRoot("xml")]
    public class Message
    {
        private string _ToUserName = string.Empty;

        public string ToUserName
        {
            get { return _ToUserName; }
            set { _ToUserName = value; }
        }

        private string _FromUserName = string.Empty;

        public string FromUserName
        {
            get { return _FromUserName; }
            set { _FromUserName = value; }
        }

        private DateTime _AddTime = DateTime.Now;

        public DateTime AddTime
        {
            set
            {
                _AddTime = value;
                CreateTime = Core.Utility.ConvertDateTimeInt(DateTime.Now).ToString();
            }
        }

        private string _CreateTime = string.Empty;
        /// <summary>
        /// 消息创建时间 （整型）
        /// </summary>
        public string CreateTime
        {
            get { return _CreateTime; }
            set { _CreateTime = value; }
        }

        /// <summary>
        /// 设置响应消息的类型
        /// </summary>
        [XmlIgnore]
        public PassiveMessageType PassiveMessageType
        {
            set
            {
                this.MsgType = value.ToString().ToLower();
            }
        }

        private string _MsgType = string.Empty;

        public string MsgType
        {
            get { return _MsgType; }
            set { _MsgType = value; }
        }

        #region text

        private string _Content = null;

        public string Content
        {
            get { return _Content; }
            set { _Content = value; }
        }

        #endregion

        #region Articles

        private int _ArticleCount = 0;

        public int ArticleCount
        {
            get { return _ArticleCount; }
            set { _ArticleCount = value; }
        }

        public List<WeiXinSDK.DataModel.MessageContent.item> Articles { get; set; }

        #endregion

        #region Image

        public WeiXinSDK.DataModel.MessageContent.Image Image { get; set; }

        #endregion

        #region Voice

        public WeiXinSDK.DataModel.MessageContent.Voice Voice { get; set; }

        #endregion

        #region Video

        public WeiXinSDK.DataModel.MessageContent.Video Video { get; set; }

        #endregion

        #region Music

        public WeiXinSDK.DataModel.MessageContent.Music Music { get; set; }

        #endregion

    }
}